﻿using NetBay.Core.BusinessEntities.Versioning;

namespace Rio.Framework.Pages.Events
{

    public delegate void VersioningEventHandler(object sender, VersioningEventArgs args);

    public class VersioningEventArgs
    {
        private VersioningItem _version;
        private string _error;
        private int _errorCode;
        private bool _hasError;
        
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <value>The item.</value>
        public VersioningItem item
        {
            get { return _version; }
        }

        /// <summary>
        /// Gets the error.
        /// </summary>
        /// <value>The error.</value>
        public string Error
        {
            get { return _error; }
        }

        /// <summary>
        /// Gets the error code.
        /// </summary>
        /// <value>The error code.</value>
        public int ErrorCode
        {
            get { return _errorCode; }
        }

        /// <summary>
        /// Gets the has error.
        /// </summary>
        /// <value>The has error.</value>
        public bool HasError
        {
            get { return _hasError; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="VersioningEventArgs" /> class.
        /// </summary>
        /// <param name="version">The version.</param>
        public VersioningEventArgs(VersioningItem version)
        {
            _version = version;
            _hasError = false;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="VersioningEventArgs" /> class.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <param name="Error">The error.</param>
        /// <param name="ErrorCode">The error code.</param>
        public VersioningEventArgs(VersioningItem version, string Error, int ErrorCode)
        {
            _version = version;
            _error = Error;
            _errorCode = ErrorCode;
            _hasError = true;
        }
    }

}
